<style>
    .layui-form-select dl { max-height:150px; }
</style>

<div style="padding: 30px;" class="layui-form seller-alone-form">

    <div class="layui-form-item">
        <label class="layui-form-label"><i class="required-color">*</i> 学号：</label>
        <div class="layui-input-inline seller-inline-4">
            <input type="text" name="xh" style="color:#C0C4CC" disabled="true" Readonly="true" class="layui-input" value="{$xh}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label"><i class="required-color">*</i> 姓名：</label>
        <div class="layui-input-inline seller-inline-4">
            <input type="text" name="xm" style="color:#C0C4CC" disabled="true" Readonly="true" class="layui-input" value="{$xm}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label"><i class="required-color">*</i> 辅导员：</label>
        <div class="layui-input-inline seller-inline-4">
            <select name="teacherId" id="teacherId" required lay-verify="required" lay-filter="teacherId" lay-search>
                <option value="">请选择辅导员</option>
                {volist name="teacherList" id="vo"}
                    <option value="{$vo.id}" {eq name="$teacherName" value="$vo.truename"}selected{/eq}>{$vo.truename}</option>
                {/volist}
            </select>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label"><i class="required-color">*</i> 方向：</label>
        <div class="layui-input-inline seller-inline-4">
            <select name="dir" lay-filter="dir" id="dir" required lay-verify="required" lay-search>
                <option value="">请选择方向</option>
                <option value="1" {eq name="$dir" value="就业"}selected{/eq}>就业</option>
                <option value="2" {eq name="$dir" value="升学"}selected{/eq}>升学</option>
                <option value="3" {eq name="$dir" value="创业"}selected{/eq}>创业</option>
            </select>
        </div>
    </div>

    {volist name="types" id="vo"}
        <div class="layui-form-item"> 
            <label class="layui-form-label">{$vo.name}：</label>
            <div class="layui-input-inline seller-inline-4">
                <select name="types[{$vo.id}]" lay-search>
                    <option value="">请选择</option>
                    {volist name="vo.Params" id="v"}
                        <option value="{$v.id}" {eq name="$vo.select" value="$v.name"}selected{/eq}>{$v.name}</option>
                    {/volist}
                </select>
            </div>
        </div>
    {/volist} 

    <div class="layui-form-item">
        <div class="layui-input-block">
            {:zlserverToken()}
            <button id="student_edit_save" class="layui-btn" lay-submit="" lay-filter="student-edit">保存</button>
        </div>
    </div>
    {:zlserverToken()}
</div>

<script>
    layui.use('form', function(){
        layui.form.render();

        //保存用户
        layui.form.on('submit(student-edit)', function (data) {
            formData = data.field;
 
            if (!formData) {
                layer.msg('请先完善数据', { time: 1300 });
                return false;
            }

            $("#student_edit_save").addClass("layui-btn-disabled");
            $('#student_edit_save').attr("disabled", true);
            JsPost("{:url('Student/edit')}", formData, function(res){
                if(res.status){
                    layer.close(window.box);
                    layer.msg(res.msg,{time:1300},function(){
                        parent.layui.admin.events.changeTabAndRefresh('/manage/student/index.html', 'studentTable');
                    });
                }else{
                    $("#student_edit_save").removeClass("layui-btn-disabled");
                    $('#student_edit_save').removeAttr("disabled");

                    layer.msg(res.msg,{time:1300});
                }
            })
            return false;
        });
    });
</script>